package com.jeesite.modules.inventory.service;

import java.util.List;

import com.jeesite.common.utils.OrgUtil;
import com.jeesite.modules.inventory.entity.qo.InventoryQO;
import com.jeesite.modules.inventory.entity.vo.InventoryVO;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeesite.common.entity.Page;
import com.jeesite.common.service.CrudService;
import com.jeesite.modules.inventory.entity.Inventory;
import com.jeesite.modules.inventory.dao.InventoryDao;

/**
 * 存货档案Service
 * @author 码脑洞
 * @version 2025-04-13
 */
@Service
public class InventoryService extends CrudService<InventoryDao, Inventory> {
	
	/**
	 * 获取单条数据
	 * @param inventory
	 * @return
	 */
	@Override
	public Inventory get(Inventory inventory) {
		return super.get(inventory);
	}
	
	/**
	 * 查询分页数据
	 * @param inventory 查询条件
	 * @param inventory page 分页对象
	 * @return
	 */
	@Override
	public Page<Inventory> findPage(Inventory inventory) {
		return super.findPage(inventory);
	}
	
	/**
	 * 查询列表数据
	 * @param inventory
	 * @return
	 */
	@Override
	public List<Inventory> findList(Inventory inventory) {
		return super.findList(inventory);
	}
	
	/**
	 * 保存数据（插入或更新）
	 * @param inventory
	 */
	@Override
	@Transactional
	public void save(Inventory inventory) {
		super.save(inventory);
	}
	
	/**
	 * 更新状态
	 * @param inventory
	 */
	@Override
	@Transactional
	public void updateStatus(Inventory inventory) {
		super.updateStatus(inventory);
	}
	
	/**
	 * 删除数据
	 * @param inventory
	 */
	@Override
	@Transactional
	public void delete(Inventory inventory) {
		super.delete(inventory);
	}

	public Page<InventoryVO> findInventoryPage(InventoryQO inventoryQO) {
		Page<InventoryVO> page = inventoryQO.getPage();
		inventoryQO.setOrgId(OrgUtil.getOrgId());
		page.setList(dao.findInventoryPage(inventoryQO));
		return page;
	}
}